package com.zg.datapush.handler;

import lombok.Data;

/**
 * 推送结果类
 * @author zg
 */
@Data
public class PushResult {

    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 消息
     */
    private String message;

    /**
     * 详细数据
     */
    private Object data;

    /**
     * 成功推送数量
     */
    private int successCount;

    /**
     * 失败推送数量
     */
    private int failedCount;

    public static PushResult success(String message) {
        PushResult result = new PushResult();
        result.setSuccess(true);
        result.setMessage(message);
        return result;
    }

    public static PushResult success(String message, Object data) {
        PushResult result = new PushResult();
        result.setSuccess(true);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public static PushResult failure(String message) {
        PushResult result = new PushResult();
        result.setSuccess(false);
        result.setMessage(message);
        return result;
    }

    public static PushResult failure(String message, Object data) {
        PushResult result = new PushResult();
        result.setSuccess(false);
        result.setMessage(message);
        result.setData(data);
        return result;
    }
}
